<?php

use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;

/**
 * Dcat-admin - admin builder based on Laravel.
 * @author jqh <https://github.com/jqhph>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 *
 * extend custom field:
 * Dcat\Admin\Form::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */

Grid::resolving(function (Grid $grid) {
    $grid->disableBatchActions();   //禁用批量操作
    $grid->disableRowSelector(); // 禁用行选择

    $grid->disableDeleteButton();
    $grid->disableViewButton();

    $grid->filter(function (Grid\Filter $filter) {
        $filter->panel();
    });
});

Form::resolving(function (Form $form) {
    $form->disableDeleteButton();
    $form->disableViewCheck();
    $form->disableEditingCheck();
    $form->disableCreatingCheck();
});

Show::resolving(function (Show $show) {
    $show->disableDeleteButton();
});


Grid\Column::extend('numberFormat', function ($value) {
    return $value ? asMoney($value) : 0;
});

